import requests

# url = "https://www.lmonkey.com/"
url = 'https://www.xicidaili.com/nn'
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0'
} # headers 改头换面
res = requests.get(url=url,headers=headers) # headers 改头换面
code = res.status_code # 请求状态吗 200
print(code)
if code == 200:
    with open('./text.html','w',encoding='utf-8') as book:
        book.write('%s' % res.content.decode('utf-8'))